package cn.openea.perpartner.componet.web.mapper;

import cn.openea.perpartner.componet.web.entity.SmsBlacklist;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 短信黑名单
 *
 * @author ysk
 * @email zane_ysk@qq.com
 * @date 2023-06-13 16:41:18
 */
@Mapper
public interface SmsBlacklistMapper extends BaseMapper<SmsBlacklist> {

    /**
     * 判断号码是否存在黑名单中
     * @param phone 手机号
     * @return int
     */
    @Select("SELECT count(1) FROM component_sms_blacklist WHERE phone = #{phone}")
    int isExist(@Param("phone") String phone);

    /**
     * 获取指定id的手机号
     * @param id id
     * @return 手机号
     */
    @Select("SELECT phone FROM component_sms_blacklist WHERE id = #{id}")
    String findPhoneById(@Param("id") Long id);
}
